Field of the Invention
The present invention generally relates to graphics processing and, more specifically, to techniques for setting up and executing draw calls.
Description of the Related Art
In conventional graphics processing systems, to render a graphics scene, a software application first sets up the scene. In so doing, the software application defines all the different shader input buffers for the different types of shader input data and sets up a command buffer for the draw calls that are to be executed to render the graphics scene. Once the shader input buffers are populated with the shader input data and the commend buffer is populated with the draw calls, a command engine within a graphics processing unit (GPU) begins pulling the draw calls from the command buffer for execution within the GPU.
When a graphics scene is rendered, only a fixed number of shader input buffers can be binded to a shader program executing within the GPU to render the graphics scene. Consequently, the total number of shader input buffers set up by the software application is oftentimes greater than the number of shader input buffers that can be binded to the shader program at any given time. Such outcomes are especially prevalent when rendering more complex graphics scenes because those graphics scenes oftentimes include numerous shader input buffers to store all of the different types of data associated with the graphics scene. For example, there may be multiple different types of geometry information associated with a complex graphics scene, where each different type of geometry information is stored in a different shader input buffer.
In situations where only a subset of the total number of shader input buffers are binded to the shader program, complications arise when a shader input buffer that is not binded to the shader program needs to be accessed. For example, a first geometry data buffer, but not a second geometry data buffer, could be binded to a shader program executing on a GPU. If the shader program wanted to access geometry data stored in the second geometry data buffer during execution, then the second geometry data buffer would have to be binded to the shader program before the shader program could access any of the geometry data in the second geometry data buffer. Binding a new shader input buffer to the shader program is expensive because the driver program has to work through the central processing unit (CPU) to bind the new shader input buffer to the shader program. As a general matter, the more times the CPU is called on to bind new buffers to a shader program during rendering, the more overall system performance is compromised.
Similarly, when a GPU generates draw calls during rendering, via a feedback shader, for example, changing shader input buffers in order to service the new draw calls requires synchronizing with the CPU because the CPU conventionally is responsible for changing shader input butters. Consequently, the CPU has to wait until the CPU has completed operations and read information back from the GPU regarding which shader input buffers to use for the new draw calls. Such synchronization operations can stall the graphic rendering pipeline, thereby negatively impacting overall performance.
As the foregoing illustrates, what is needed in the art is a more effective way to switch between shader input buffers when rendering a graphics scene.